package com.atstudy.list;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @version v1.0
 * @description:
 * @author: admin
 * @date: 2023/1/3 10:04
 * @copyright: 博为峰
 */
public class ArrayListDemo {
    public static void main(String[] args) {
        //初始容器10的空数组{}
        ArrayList arrayList = new ArrayList();
        arrayList.add(new Student("张三", 20));
        arrayList.add(new Student("李四", 30));
        arrayList.add(new Student("王五", 50));
        arrayList.add(new Student("王五", 50));
        //遍历(迭代)
        Iterator iterator = arrayList.iterator();
        while (iterator.hasNext()){
            Student student = (Student)iterator.next();
            System.out.println(student);
        }
    }
}
